#include "widget.h"
#include "ui_widget.h"

#include <QDebug>
#include <QFile>
#include <QTextStream>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QFile file("C:/Users/mzx/Desktop/config.txt");
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qDebug() << "文件打开失败";
        return;
    }
    QTextStream in(&file);
    in.setCodec("utf8");
    while (!in.atEnd())
    {
        QString line = in.readLine();
        ui->comboBox->addItem(line);
    }
    file.close();
}

Widget::~Widget()
{
    delete ui;
}

